/******************************************************************************
COPYRIGHT (C) 2013 by IT-Designers GmbH

File:		BEViewer.cpp
Created:	25.02.2013
Modified:	27.02.2013
Author:		Max Pejs
******************************************************************************/

#include "BEViewer.h"

BEViewer::BEViewer(string & filename, string & matrixIndex)
{
	FileStorage fs(filename, FileStorage::READ);
	fs[matrixIndex.c_str()] >> Homography;
}

BEViewer::BEViewer(Mat H): Homography(H){}

BEViewer::~BEViewer(){}

void BEViewer::Transform(Mat & srcImage, Mat & dstImage)
{
	Size s((int)((double)srcImage.cols * 0.5f), (int)((double)srcImage.rows * 2.0f ));

	warpPerspective(srcImage, dstImage, Homography, s);
}

Mat BEViewer::GetHomography()
{
	return Homography;
}

Mat BEViewer::GetInvHomography()
{
	Mat invertedHomography;
	invert(Homography, invertedHomography);
	return invertedHomography;
}